package com;

import org.aspectj.lang.annotation.Aspect;
import org.springframework.scheduling.annotation.Async;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;

public class BuffwTest {
    public static void main(String[] args) throws IOException {
        Process mysql = Runtime.getRuntime().exec("mysql");
        System.out.println(mysql);
//        String commod = "mysqldump -u"+username+" -p"+password+" -h"+host+" -P"+port+" --single-transaction " +
//                "--master-data=2 --events --routines  --databases " +dataBaseName+"  -n -t " +
//                "--result-file="+sqlPath+dataBaseName+".sql";
//        //调用系统黑窗口，运行命令
//        Process p = null;
//        try {
////            synchronized (this){
//            p = Runtime.getRuntime().exec(commod);
////            }
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
    }

    @Async("taskExecutor")
    public void writeFile() throws IOException {
        File file = new File("D:/database.txt");
        FileWriter fileWriter = new FileWriter(file, true);
        BufferedWriter bufferedWriter1 = new BufferedWriter(fileWriter);
        for (int i = 0; i < 50000; i++) {
            bufferedWriter1.write("\n2022-09-19 10:04:14||0||1||699||0||2022-09-19 10:34:14||2022-09-19 10:04:14");
        }
        fileWriter.close();

    }


}
